package com.yzt.zhuju.dialog;

import android.view.View;
import android.widget.TextView;

import com.yzt.zhuju.R;
import com.yzt.zhuju.network.entity.user.PersonalDetail;
import com.yzt.plugin_widget.RoundImageView;

/**
 * author : bob
 * date   : 2022/12/7
 * desc   : 直播中主播接听弹窗
 */
public class CallAnswerDialog extends CenterBaseDialog implements View.OnClickListener {

    private RoundImageView roundImageView;

    private TextView tvNickname;

    private TextView tvRefuse;

    private TextView tvAccept;

    @Override
    public int getLayoutRes() {
        return R.layout.float_call_answer;
    }

    @Override
    public void bindView(View v) {

        PersonalDetail bean = (PersonalDetail) getArguments().getSerializable("user_info");
        roundImageView = v.findViewById(R.id.avatar_iv);
        tvNickname = v.findViewById(R.id.tv_nickname);
        tvRefuse = v.findViewById(R.id.tv_refuse);
        tvAccept = v.findViewById(R.id.tv_accept);
        tvRefuse.setOnClickListener(this);
        tvAccept.setOnClickListener(this);

//        ImageLoadUtil.loadImg(mActivity, bean.getBasic().getPortraitUrl(), roundImageView);
//        tvNickname.setText(bean.getBasic().getUserName());
    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        if (v.getId() == R.id.tv_refuse) {
            // 拒绝 - 关闭页面 发送消息
            dismissAllowingStateLoss();
            if (listener != null) {
                listener.selectCancel();
            }
        }
        if (v.getId() == R.id.tv_accept) {
            // 接听 - 关闭页面 关闭直播 跳转到接听页面
            dismissAllowingStateLoss();
            if (listener != null) {
                listener.selectSubmit();
            }
        }
    }

    private OnSelectOnClickListener listener;

    public void setListener(OnSelectOnClickListener listener) {
        this.listener = listener;
    }

    public interface OnSelectOnClickListener {

        void selectSubmit();

        void selectCancel();
    }
}
